export const getToken = () => {
  return localStorage.getItem('_mobile_site_token');
};
export const formatTime = (value: string | number | Date): string => {
  const date = new Date(value);

  // 检查日期是否有效
  if (isNaN(date.getTime())) {
    throw new Error('Invalid date value');
  }

  const Y = date.getFullYear();
  const M = String(date.getMonth() + 1).padStart(2, '0');
  const d = String(date.getDate()).padStart(2, '0');
  const h = String(date.getHours()).padStart(2, '0');
  const m = String(date.getMinutes()).padStart(2, '0');
  const s = String(date.getSeconds()).padStart(2, '0');

  return `${Y}-${M}-${d} ${h}:${m}:${s}`;
};
